package at.ac.big.tuwien.ewa.twitter;

import twitter4j.DirectMessage;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
import twitter4j.conf.ConfigurationBuilder;

public class TwitterConnectorImpl implements TwitterConnector {

	@Override
	public Status postMessage(Score score) throws TwitterException {
		String message = score.getTwitterPublicationString();
		ConfigurationBuilder confbuilder = new ConfigurationBuilder();
		confbuilder.setOAuthConsumerKey("wtiN7z11bj1maF40Zq6AWQ");
		confbuilder.setOAuthConsumerSecret("AflpieP9jpO1HEyNmHALn0CwfzYbmWWRuc8u8Hp5OU");
		confbuilder.setOAuthAccessToken("572677190-saDa4wDz4Vu46gC5pVLQ2zZ0F2b8O6tHqc5UWbk2");
		confbuilder.setOAuthAccessTokenSecret("ZbCBnDDPxTtsqYwVHN4kHJLUDeGywF6fRLZnpDtpo");
		TwitterFactory twitterFactory = new TwitterFactory(confbuilder.build());
		Twitter twitter = twitterFactory.getInstance();
		Status status = twitter.updateStatus(message);
		return status;
	}

}
